<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="description" content="Metro, a sleek, intuitive, and powerful framework for faster and easier web development for Windows Metro Style.">
    <meta name="keywords" content="HTML, CSS, JS, JavaScript, framework, metro, front-end, frontend, web development">
    <meta name="author" content="Sergey Pimenov and Metro UI CSS contributors">

    <link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
    <title>Metro UI CSS - The front-end framework for developing projects on the web in Windows Metro Style</title>

    <link href="css/metro.css" rel="stylesheet">
    <link href="css/metro-icons.css" rel="stylesheet">
    <link href="css/metro-responsive.css" rel="stylesheet">
    <link href="css/metro-schemes.css" rel="stylesheet">

    <link href="css/docs.css" rel="stylesheet">

    <script src="js/jquery-2.1.3.min.js"></script>
    <script src="js/metro.js"></script>
    <script src="js/docs.js"></script>
    <script src="js/prettify/run_prettify.js"></script>
    <script src="js/ga.js"></script>
    <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
</head>
<body>
    <div class="container page-content">
        <h1><a href="index.html" class="nav-button transform"><span></span></a>&nbsp;Title</h1>

        <div class="example">
            <div class="treeview" data-role="treeview" id="treeview1"></div>
        </div>

        <script>
            var data = {
                "subelem0": "app.config",
                "subelem1": "DeckExporter.cs",
                "subelem2": "Github.cs",
                "subelem3": "HDTCompatibilityWindow.cs",
                "subelem4": "HDTCompatibilityWindow.csproj",
                "subelem5": "HDTCompatibilityWindowPlugin.cs",
                "Properties": {
                    "subelem0": "AssemblyInfo.cs",
                    "subelem1": "Resources.Designer.cs",
                    "subelem2": "Resources.resx",
                    "subelem3": "Settings.Designer.cs",
                    "subelem4": "Settings.settings"
                },
                "Util": {
                    "subelem0": "MultiBooleanConverter.cs",
                    "subelem1": "User32.cs"
                },
                "Windows": {
                    "subelem0": "CompatibilityWindow.xaml",
                    "subelem1": "CompatibilityWindow.xaml.cs",
                    "subelem2": "HDTCompatibilityAbout.xaml",
                    "subelem3": "HDTCompatibilityAbout.xaml.cs",
                    "subelem4": "HDTCompatibilitySettings.xaml",
                    "subelem5": "HDTCompatibilitySettings.xaml.cs"
                }
            };

            $(function(){
                var treeview = $("#treeview1").data("treeview");
                var root, node;

                root = treeview.addLeaf(false, "Root");

                add(root, data);

                function add(parent, data){
                    $.each(data, function(key, value){
                        if (typeof value === 'string') {
                            treeview.addLeaf(parent, this);
                        } else if (typeof value === 'object') {
                            node = treeview.addLeaf(parent, "Node " + key);
                            add(node, value);
                        }
                    });
                }
            });
        </script>

        <pre class="prettyprint linenums no-scroll"><code>
            &lt;div class="treeview" data-role="treeview" id="treeview1"&gt;&lt;/div&gt;

            &lt;script&gt;
                var data = {
                    object1: "Leaf 1",
                    object2: {
                        subobject_2_1: "Leaf 2.1",
                        subobject_2_2: "Leaf 2.2",
                        subobject_2_3: "Leaf 2.2"
                    },
                    object3: {
                        subobject3_1: "Leaf 3.1",
                        subobject3_2: "Leaf 3.2",
                        subobject3_3: "Leaf 3.2"
                    }
                };

                $(function(){
                    var treeview = $("#treeview1").data("treeview");
                    var root, node;

                    root = treeview.addLeaf(false, "Root");

                    add(root, data);

                    function add(parent, data){
                        $.each(data, function(key, value){
                            if (typeof value === 'string') {
                                treeview.addLeaf(parent, this);
                            } else if (typeof value === 'object') {
                                node = treeview.addLeaf(parent, "Node " + key);
                                add(node, value);
                            }
                        });
                    }
                });
            &lt;/script&gt;
        </code></pre>
    </div>
</body>
</html>